package org.travel_system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.travel_system.mapper.EmergencyMapper;
import org.travel_system.pojo.EmergencyInformation;
import org.travel_system.service.EmergencyService;

import java.util.List;

@Service
public class EmergencyServiceImpl implements EmergencyService
{
    private final EmergencyMapper emergencyMapper;

    @Autowired
    public EmergencyServiceImpl(EmergencyMapper emergencyMapper)
    {
        this.emergencyMapper = emergencyMapper;
    }

    @Override
    public List<EmergencyInformation> getEmergencies()
    {
        return emergencyMapper.getEmergencies();
    }

    @Override
    public EmergencyInformation getEmergencyById(int id)
    {
        return emergencyMapper.getEmergencyById(id);
    }

    @Override
    public List<EmergencyInformation> getEmergenciesApproved()
    {
        return emergencyMapper.getEmergenciesApproved();
    }

    @Override
    public int addEmergency(EmergencyInformation emergencyInformation)
    {
        return emergencyMapper.addEmergency(emergencyInformation);
    }

    @Override
    public int approveEmergency(int id) {
        return emergencyMapper.approveEmergency(id);
    }
}
